// src/APP.vue

<template>
  <div>1、HTML元素上使用</div>
  <input ref="input" />

  <br>
  <br>


  <div>2、组件上使用</div>
  <base-input ref="usernameInput"></base-input>

  <br>
  <br>

</template>

<script lang="ts">
import BaseInput from './components/base-input.vue'

export default {
  name: 'APP',
  components:{
    BaseInput
  },
  methods: {
    focusInput() {
      this.$refs.input.focus()
    }
  },
  mounted() {
    this.$refs.usernameInput.doInput()
    this.focusInput()
  }
}
</script>